module.exports = app => {
  const { router, controller, middleware } = app;
  const jwtAuth = middleware.jwt(app.config.jwt);
  // 用户
  router.post('/api/v1/user/testName', controller.v1.users.testName)
  router.post('/api/v1/user/register', controller.v1.users.register)
  router.post('/api/v1/user/login', controller.v1.users.login)
  router.post('/api/v1/user/getUserInfo', jwtAuth, controller.v1.users.getUserInfo)
  router.post('/api/v1/user/getUserIdInfo', jwtAuth, controller.v1.users.getUserIdInfo)
  // 文章
  router.post('/api/v1/article/getArticles', jwtAuth, controller.v1.articles.getArticles)
  router.post('/api/v1/article/getArticlesByAuthor', jwtAuth, controller.front.articles.getArticlesByAuthor)
  router.post('/api/v1/article/getArticleById', jwtAuth, controller.front.articles.getArticleById)
  router.post('/api/v1/article/getArticlesByCollection', jwtAuth, controller.front.articles.getArticlesByCollection)
  router.post('/api/v1/article/likeArticle', jwtAuth, controller.front.articles.likeArticle)
  router.post('/api/v1/article/viewArticle', jwtAuth, controller.front.articles.viewArticle)
  // 收藏夹
  router.post('/api/v1/collection/getCollectionsByOwner', jwtAuth, controller.front.collections.getCollectionsByOwner)
  router.post('/api/v1/collection/getArticleByCollection', jwtAuth, controller.front.collections.getArticleByCollection)
  router.post('/api/v1/collection/addToCollection', jwtAuth, controller.front.collections.addToCollection)
  router.post('/api/v1/collection/collectionHasArticle', jwtAuth, controller.front.collections.collectionHasArticle)
  router.post('/api/v1/collection/deleteFromCollection', jwtAuth, controller.front.collections.deleteFromCollection)
  router.post('/api/v1/collection/clearCollection', jwtAuth, controller.front.collections.clearCollection)
  router.post('/api/v1/collection/createCollection', jwtAuth, controller.front.collections.createCollection)
  router.post('/api/v1/collection/editCollection', jwtAuth, controller.front.collections.editCollection)
  router.post('/api/v1/collection/deleteCollection', jwtAuth, controller.front.collections.deleteCollection)
  // 打卡
  router.post('/api/v1/task/uploadTask', controller.front.tasks.uploadTask)
  router.post('/api/v1/task/getTasks', jwtAuth, controller.front.tasks.getTasks)
  router.post('/api/v1/task/getTask', jwtAuth, controller.front.tasks.getTask)
  router.post('/api/v1/task/getMonthTasks', jwtAuth, controller.front.tasks.getMonthTasks)
  router.post('/api/v1/task/getWeekTasks', jwtAuth, controller.front.tasks.getWeekTasks)
  router.post('/api/v1/task/saveTask', jwtAuth, controller.front.tasks.saveTask)
  router.post('/api/v1/task/addPoints', jwtAuth, controller.front.tasks.addPoints)
}